/* 
    数组取差集
*/

function difference(arr1, arr2 = []) {
    if (arr1.length === 0) {
        return [];
    }
    if (arr2.length === 0) {
        return arr1;
    }
    if (arr2.length > arr1.length) {
        let temp;
        temp = arr2;
        arr2 = arr1;
        arr1 = temp;
    }
    let result = []
    arr1.forEach(item => {
        if (!arr2.includes(item)) {
            result.push(item)
        }
    })
    return result;
}